package com.fr.base.core.util.vt;

import com.fr.base.core.BaseCoreUtils;
import com.fr.base.core.ComparatorUtils;
import com.fr.base.core.FRCoreContext;
import com.fr.base.core.RSADecode;
import com.fr.base.core.json.JSONObject;
import com.fr.util.Consts;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public final class VT4FR
{
  public static final String VERSION = "version";
  public static final String MACADDRESS = "macaddress";
  public static final String DEADLINE = "deadline";
  public static final String APPNAME = "appname";
  public static final String PROJECTNAME = "projectname";
  public static final String COMPANYNAME = "companyname";
  public static final String CONCURRENCY = "concurrency";
  public static final String FUNCTION = "function";
  private static final String DEPRECATED_EDITION = "edition";
  public static final String CHECKFAIL = "failpass";
  public static final String ADDRESSDELIMIER = ",";
  private static int functions = 524287;
  private static List FUNC_LIST = new ArrayList();
  public static final FUNC SOURCE_RELATION = new FUNC()
  {
    public int marker()
    {
      return 1;
    }

    public boolean basicSupported()
    {
      return true;
    }

    public boolean developmentSupported()
    {
      return true;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC ADVANCED_CHART = new FUNC()
  {
    public int marker()
    {
      return 2;
    }

    public boolean basicSupported()
    {
      return true;
    }

    public boolean developmentSupported()
    {
      return true;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC ADVANCED_FORMULA = new FUNC()
  {
    public int marker()
    {
      return 4;
    }

    public boolean basicSupported()
    {
      return false;
    }

    public boolean developmentSupported()
    {
      return true;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC FLASH_PRINT = new FUNC()
  {
    public int marker()
    {
      return 8;
    }

    public boolean basicSupported()
    {
      return false;
    }

    public boolean developmentSupported()
    {
      return true;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC SERVER_CLUSTER = new FUNC()
  {
    public int marker()
    {
      return 16;
    }

    public boolean basicSupported()
    {
      return false;
    }

    public boolean developmentSupported()
    {
      return true;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC DYNAMIC_CHART = new FUNC()
  {
    public int marker()
    {
      return 32;
    }

    public boolean basicSupported()
    {
      return false;
    }

    public boolean developmentSupported()
    {
      return false;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC SCHEDULE = new FUNC()
  {
    public int marker()
    {
      return 64;
    }

    public boolean basicSupported()
    {
      return false;
    }

    public boolean developmentSupported()
    {
      return false;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC ADHOC = new FUNC()
  {
    public int marker()
    {
      return 128;
    }

    public boolean basicSupported()
    {
      return false;
    }

    public boolean developmentSupported()
    {
      return false;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC ONLINE_EDIT = new FUNC()
  {
    public int marker()
    {
      return 256;
    }

    public boolean basicSupported()
    {
      return false;
    }

    public boolean developmentSupported()
    {
      return false;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC PERFORMCE_OPTIMISE = new FUNC()
  {
    public int marker()
    {
      return 512;
    }

    public boolean basicSupported()
    {
      return false;
    }

    public boolean developmentSupported()
    {
      return false;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return false;
    }
  };
  public static final FUNC ADVANCED_ONLINE_WRITE = new FUNC()
  {
    public int marker()
    {
      return 1024;
    }

    public boolean basicSupported()
    {
      return false;
    }

    public boolean developmentSupported()
    {
      return false;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return false;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC PRIVILIGE = new FUNC()
  {
    public int marker()
    {
      return 2048;
    }

    public boolean basicSupported()
    {
      return true;
    }

    public boolean developmentSupported()
    {
      return true;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC COLLAPSABLE_TREE_VIEW = new FUNC()
  {
    public int marker()
    {
      return 4096;
    }

    public boolean basicSupported()
    {
      return false;
    }

    public boolean developmentSupported()
    {
      return true;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC FROZEN_VIEW = new FUNC()
  {
    public int marker()
    {
      return 8192;
    }

    public boolean basicSupported()
    {
      return true;
    }

    public boolean developmentSupported()
    {
      return true;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC PARAMETER_INTERFACE = new FUNC()
  {
    public int marker()
    {
      return 16384;
    }

    public boolean basicSupported()
    {
      return true;
    }

    public boolean developmentSupported()
    {
      return true;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC ONLINE_WRITE = new FUNC()
  {
    public int marker()
    {
      return 32768;
    }

    public boolean basicSupported()
    {
      return true;
    }

    public boolean developmentSupported()
    {
      return true;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC PREDEFINED_WIDGET = new FUNC()
  {
    public int marker()
    {
      return 65536;
    }

    public boolean basicSupported()
    {
      return true;
    }

    public boolean developmentSupported()
    {
      return true;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC WORK_BOOK = new FUNC()
  {
    public int marker()
    {
      return 131072;
    }

    public boolean basicSupported()
    {
      return true;
    }

    public boolean developmentSupported()
    {
      return true;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return true;
    }
  };
  public static final FUNC REMOTE_DESIGN = new FUNC()
  {
    public int marker()
    {
      return 262144;
    }

    public boolean basicSupported()
    {
      return false;
    }

    public boolean developmentSupported()
    {
      return false;
    }

    public boolean enterpriseSupported()
    {
      return true;
    }

    public boolean professionalSupported()
    {
      return true;
    }

    public boolean standardSupported()
    {
      return false;
    }
  };

  public static void main(String[] paramArrayOfString)
  {
    FUNC localFUNC;
    int i = 0;
    ArrayList localArrayList = new ArrayList();
    i = 0;
    localArrayList = new ArrayList();
    for (int j = 0; j < FUNC_LIST.size(); ++j)
    {
      localFUNC = (FUNC)FUNC_LIST.get(j);
      if (localFUNC.enterpriseSupported())
      {
        i += localFUNC.marker();
        localArrayList.add(new Integer(localFUNC.marker()));
      }
    }
    System.out.println("企业版");
    System.out.println(i);
    System.out.println(BaseCoreUtils.join(localArrayList, ","));
    System.out.println("********************************************************");
    i = 0;
    localArrayList = new ArrayList();
    for (j = 0; j < FUNC_LIST.size(); ++j)
    {
      localFUNC = (FUNC)FUNC_LIST.get(j);
      if (localFUNC.professionalSupported())
      {
        i += localFUNC.marker();
        localArrayList.add(new Integer(localFUNC.marker()));
      }
    }
    System.out.println("专业版");
    System.out.println(i);
    System.out.println(BaseCoreUtils.join(localArrayList, ","));
    System.out.println("********************************************************");
    i = 0;
    localArrayList = new ArrayList();
    for (j = 0; j < FUNC_LIST.size(); ++j)
    {
      localFUNC = (FUNC)FUNC_LIST.get(j);
      if (localFUNC.standardSupported())
      {
        i += localFUNC.marker();
        localArrayList.add(new Integer(localFUNC.marker()));
      }
    }
    System.out.println("标准版");
    System.out.println(i);
    System.out.println(BaseCoreUtils.join(localArrayList, ","));
    System.out.println("********************************************************");
    i = 0;
    localArrayList = new ArrayList();
    for (j = 0; j < FUNC_LIST.size(); ++j)
    {
      localFUNC = (FUNC)FUNC_LIST.get(j);
      if (localFUNC.developmentSupported())
      {
        i += localFUNC.marker();
        localArrayList.add(new Integer(localFUNC.marker()));
      }
    }
    System.out.println("开发版");
    System.out.println(i);
    System.out.println(BaseCoreUtils.join(localArrayList, ","));
    System.out.println("********************************************************");
    i = 0;
    localArrayList = new ArrayList();
    for (j = 0; j < FUNC_LIST.size(); ++j)
    {
      localFUNC = (FUNC)FUNC_LIST.get(j);
      if (localFUNC.basicSupported())
      {
        i += localFUNC.marker();
        localArrayList.add(new Integer(localFUNC.marker()));
      }
    }
    System.out.println("基本版");
    System.out.println(i);
    System.out.println(BaseCoreUtils.join(localArrayList, ","));
    System.out.println("********************************************************");
  }

  static List access$000()
  {
    return FUNC_LIST;
  }

  static int access$100()
  {
    return functions;
  }

  static
  {
    byte[] arrayOfByte = FRCoreContext.getBytes();
    ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
    try
    {
      RSADecode.decode(arrayOfByte, localByteArrayOutputStream);
    }
    catch (Exception localException1)
    {
    }
    try
    {
      JSONObject localJSONObject = new JSONObject(new String(localByteArrayOutputStream.toByteArray(), "UTF-8"));
      if ((localJSONObject.getLong("deadline") > Calendar.getInstance().getTimeInMillis()) && (localJSONObject.has("version")) && (ComparatorUtils.equals(Consts.VERSION, localJSONObject.getString("version"))) && (((localJSONObject.getLong("deadline") - Calendar.getInstance().getTimeInMillis() < 3153600000L) || ((localJSONObject.has("macaddress")) && (BaseCoreUtils.getMacAddresses().contains(localJSONObject.getString("macaddress")))))))
        if (localJSONObject.has("edition"))
        {
          int i = localJSONObject.getInt("edition");
          switch (i)
          {
          case 0:
            break;
          case 1:
            functions = 523263;
            break;
          case 2:
            functions = 261631;
            break;
          case 3:
            functions = 260127;
            break;
          case 4:
            functions = 256003;
          }
        }
        else if (localJSONObject.has("function"))
        {
          functions = localJSONObject.getInt("function");
        }
    }
    catch (Exception localException2)
    {
    }
  }

  public static abstract class FUNC
  {
    FUNC()
    {
      VT4FR.access$000().add(this);
    }

    public boolean support()
    {
      return ((VT4FR.access$100() & marker()) > 0);
    }

    public abstract int marker();

    public abstract boolean enterpriseSupported();

    public abstract boolean professionalSupported();

    public abstract boolean standardSupported();

    public abstract boolean developmentSupported();

    public abstract boolean basicSupported();
  }
}